import { notFound } from "next/navigation"; import type { ReactNode } from "react"; import { api } from "@/lib/api"; /** Existence gate — real HTTP 404 before the segment's loading.tsx streams a 200 shell (the page re-uses the cached fetch). */ export default async function CountryLayout({ children, params }: { children: ReactNode; params: Promise<{ slug: string }> }) { const { slug } = await params; const r = await api.country(slug); if (!r.ok && r.status === 404) notFound(); return <>{children}; }